<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Facades\DB;

class CreateCmsNavsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        if (!Schema::hasTable('cms_navs')) {
            Schema::create('cms_navs', function (Blueprint $table) {
                $table->id();
                $table->enum('is_main', ['yes', 'no'])->default('yes')->comment('是否主导航:yes是, no否');
                $table->string('name', 100)->comment('导航位置名称,例:主导航,底部导航...');
                $table->timestamps();
            });
            DB::statement("ALTER TABLE `cms_navs` comment 'CMS前台导航位置表'");
        }
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('cms_navs');
    }
}
